home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 August / Australian PC User - August 2003 (CD1).iso / resource / looppatt / files / flstudio.exe / Help / FD.chm / html / _casecommon2.js < prev    next >
Encoding:
Text File  |  2003-04-08  |  14.8 KB  |  279 lines

  1. // shared decoding and rendering routines
  2.  
  3. // global objects
  4. params=new Array();
  5. userData=new Array();
  6.  
  7. // --------------------------------------
  8. // registration information
  9. // --------------------------------------
  10. regInfo=[];
  11. regInfo[0]={code:31020,name:'FL Studio Producer Edition',registered:false,needed:false}; // FL
  12. regInfo[1]={code:31010,name:'FL Studio FruityLoops Edition',registered:false,needed:false};
  13. regInfo[2]={code:31000,name:'FL Studio Express Edition',registered:false,needed:false};    
  14. regInfo[3]={code:37030,name:'Fruity Soundfont Player',registered:false,needed:false, isPlug:true}; // Plugins
  15. regInfo[4]={code:37020,name:'Fruity DX10',registered:false,needed:false, isPlug:true};
  16. regInfo[5]={code:33300,name:'Wasp',registered:false,needed:false, isPlug:true};
  17. regInfo[6]={code:33110,name:'SimSynth',registered:false,needed:false, isPlug:true};
  18. regInfo[7]={code:33000,name:'Fruity DrumSynth Live',registered:false,needed:false, isPlug:true};
  19. regInfo[8]={code:33400,name:'DreamStation DXi',registered:false,needed:false, isPlug:true};
  20. regInfo[9]={code:22100,name:'SimSynth (standalone)',registered:false,needed:false, isPlug:false};
  21. regInfo[10]={code:22250,name:'EZ-Editor',registered:false,needed:false, isPlug:false};
  22. regInfo[11]={code:22220,name:'BeatSlicer',registered:false,needed:false, isPlug:false};
  23. //    {code:37021,name:'DX10 VSTi/DXi',registered:false,needed:false, isPlug:true};  
  24. //    {code:37310,name:'WASP VSTi/DXi',registered:false,needed:false, isPlug:true}; 
  25. //    {code:37110,name:'SimSynth Live VSTi/DXi',registered:false,needed:false, isPlug:true};  
  26. //    {code:33400,name:'DreamStation DXi',registered:false,needed:false, isPlug:true},        
  27. // object with product text info (matches the index from the previous one)
  28. productText=[];
  29. // **** PRODUCER **** <<START>>
  30. productText[0]='<div align="center"><img src="img_glob/_fllogo_producer.gif" width="180" height="83"></div>';
  31. productText[0]+='<span class="fl-emph">FL Studio Producer Edition contains: </span>';
  32. productText[0]+='<ul><li class="fl-text">All <span class="fl-emph">Fruityloops Edition</span> features and…</li>';
  33. productText[0]+='<li class="fl-text"> New Mixer Window (64 channels, track rerouting, ASIO track recording, integrated EQ and more).</li>';
  34. productText[0]+='<li class="fl-text"> Audio tracks with waveform preview & support for cue points.</li>';
  35. productText[0]+='<li class="fl-text"> Direct-to-disk recording & offline rendering of mixer tracks. </li>';
  36. productText[0]+='<li class="fl-text"> Integrated Wave Editor.</li>';
  37. productText[0]+='<li class="fl-text"> Life Time Free Updates to this edition.</li>';
  38. // **** PRODUCER **** <<END>>
  39. // **** FRUITYLOOPS **** <<START>>
  40. productText[1]='<div align="center"><img src="img_glob/_fllogo_fl.gif" width="180" height="83"></div>';
  41. productText[1]+='<span class="fl-emph">FL Studio Fruityloops Edition contains:</span>';
  42. productText[1]+='<ul><li class="fl-text">All <span class="fl-emph">Express Edition</span> features and…</li>';
  43. productText[1]+='<li class="fl-text">Piano roll allowing chords.</li>';
  44. productText[1]+='<li class="fl-text">Full automation of all wheels.</li>';
  45. productText[1]+='<li class="fl-text">ASIO support (allowing 2ms latency!).</li>';
  46. productText[1]+='<li class="fl-text">Internal controllers.</li>';
  47. productText[1]+='<li class="fl-text">Can be used as VSTi client in hosts like Cubase, Sonar, Logic, Orion, ...</li>';
  48. productText[1]+='<li class="fl-text">Life Time Free Updates to this edition.</li>';
  49. // **** FRUITYLOOPS **** <<END>>
  50. // **** EXPRESS **** <<START>>
  51. productText[2]='<div align="center"><img src="img_glob/_fllogo_express.gif" width="180" height="83"></div>';
  52. productText[2]+='<span class="fl-emph">FL Studio Express Edition contains:</span>';
  53. productText[2]+='<ul><li class="fl-text">External generators.</li>';
  54. productText[2]+='<li class="fl-text">16Bit 44KHz stereo.</li>';
  55. productText[2]+='<li class="fl-text">External midi control</li>';
  56. productText[2]+='<li class="fl-text">Unlimited number of channels</li>';
  57. productText[2]+='<li class="fl-text">4 to 64 notes in a pattern sequencer.</li>';
  58. productText[2]+='<li class="fl-text">Integrated TS-404 bassline.</li>';
  59. productText[2]+='<li class="fl-text">Support for VSTi & DXi.</li>';
  60. productText[2]+='<li class="fl-text">Export to wav, MP3 & MIDI.</li>';
  61. productText[2]+='<li class="fl-text">Playlist.</li>';
  62. productText[2]+='<li class="fl-text">Piano keyboard.</li>';
  63. productText[2]+='<li class="fl-text">Life Time Free Updates to this edition.</li>';
  64. // **** EXPRESS **** <<END>>
  65. productText[3]='Fruity Soundfont Player is an FL Studio add-on that gives you the power to load, play and render soundfonts (.sf2 files).';
  66. productText[4]='This DX10 FM synth is an FL Studio add-on that recreates the classic FM sound by using a harmonically rich modulating oscillator. Intuitive interface!';
  67. productText[5]='The WASP is the FL Studio generator version of the WASP, a complex subtractor using 2 oscillators. You get both the Fruity as the VSTi version.';
  68. productText[6]='SimSynth Live is the FL Studio generator version of SimSynth. This is a <b>realtime</b> version of the standalone version of SimSynth that can be run INSIDE FL Studio.';
  69. productText[7]='Gives you the power of Live drums in your FL Studio productions. Tweak your drums until they are just perfect!';
  70. productText[8]='Dreamstation DXi is a versatile DirectX instrument creating "analog synth" quality sounds that works inside all DXi compatible hosts like FL Studio and Sonar.';
  71. productText[9]='SimSynth Standalone is the original version of SimSynth. It has more advanced settings and can produce a wider variety of sounds but can not run in FL Studio. However, FL Studio can use its presets and riffs as regular samples!';
  72. productText[10]='EZ Editor is the ideal companion for all your sample handling. Recording of WAV, set loop points, create custom shapes (formula editor), extract SoundFonts, ... ';
  73. productText[11]='BeatSlicer is an application that allows you to "slice" drumbreaks or other loops into its individual parts, rearrange them and use them inside FL Studio.';
  74. // --------------------------------------
  75.  
  76. // --------------------------------------
  77. // this section contains routines to decode
  78. // the parameters
  79. // --------------------------------------
  80. function arrBase16_dec() { // decode info an array
  81.     var source=((paramsSource).slice(1)).toUpperCase(); // dump "G" at start & capitalize
  82.     var i=0,j=0;
  83.     var base16='0123456789ABCDEF';
  84.     var buffer=new Array();
  85.     buffer=source.split('G');
  86.     // init  (in case FL doesn't pass anything)
  87.     params[0]='';    params[1]='';    params[2]='';    params[3]='';    params[4]='';    
  88.     // parse
  89.     for (i=0;i<buffer.length;i++) {
  90.         params[i]='';
  91.         for (j=0;j<buffer[i].length;j+=2) {
  92.              params[i]+=String.fromCharCode(16*base16.indexOf(buffer[i].charAt(j))+base16.indexOf(buffer[i].charAt(j+1)));
  93.         }
  94.     }
  95. }
  96. function user_dec() { // decodes the user data elements
  97.     // init  (in case FL doesn't pass anything)
  98.     userData[0]='';userData[1]='';userData[2]='';userData[3]='';
  99.     // parse
  100.     userData[0]=params[1].substring(0,params[1].indexOf(':'));
  101.     userData[1]=params[1].substring(params[1].indexOf(':')+1,params[1].lastIndexOf(':'));
  102.     userData[2]=params[1].substring(params[1].indexOf('[')+1,params[1].indexOf(']'));
  103.     userData[3]=params[1].substring(params[1].indexOf('|')+1,params[1].lastIndexOf('|')).slice('|');
  104.     // DEBUG
  105.     //userData[3]='[]';
  106.     // END DEBUG    
  107. }
  108. function scanRegInfo() { // scans ID-s and pluglist and updates regInfo
  109.     var i,j;
  110.     // scan codes
  111.     var codes=userData[3].split('|');    
  112.     for (i=0;i<codes.length;i++) {
  113.         for (j=0;j<regInfo.length;j++) {
  114.             if (regInfo[j].code==Number(codes[i])) {
  115.                 regInfo[j].registered=true;
  116.             }
  117.         }
  118.     }
  119.     // scan pluglist
  120.     var pluglist=params[4].split(':');
  121.     for (i=0;i<pluglist.length;i++) {
  122.         for (j=0;j<regInfo.length;j++) {
  123.             if (regInfo[j].name.toUpperCase()==pluglist[i].toUpperCase()) {
  124.                 regInfo[j].needed=true;
  125.             }
  126.         }
  127.     }    
  128. }
  129. // --------------------------------------
  130.  
  131. // --------------------------------------
  132. // to pass parameters as an URL
  133. // --------------------------------------
  134. function escape2(source) {
  135.     var i,c;
  136.     var result='';
  137.     for (i=0;i<source.length;i++) {
  138.         c=source.charAt(i);
  139.         switch (true) {
  140.              case (c==' '):
  141.                 result+='+'; break;
  142.             case ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='.' || c=='/' || c=='\\'):
  143.                 result+=c; break;
  144.             default:
  145.                 result+='%'+(Number(source.charCodeAt(i)).toString(16)).toUpperCase();
  146.         }    
  147.   }
  148.     return result;
  149. }
  150. // --------------------------------------
  151.  
  152. // --------------------------------------
  153. // procedures for managing the expanding tables
  154. // --------------------------------------
  155. function switchDTable(name) { // switches the body DIV of the table
  156.     var tableBody=eval(name+'body');
  157.   var tableGadget=eval(name+'gadget');
  158.     if (tableBody.style.display=='none' || tableBody.style.display=='') {
  159.         tableBody.style.display='block';
  160.         tableGadget.src='img_glob/_dyntbl_topleft2.gif';
  161.     }    else {
  162.         tableBody.style.display='none';
  163.         tableGadget.src='img_glob/_dyntbl_topleft1.gif';
  164.     }    
  165. }
  166. var countDTable=1; // this variable is used to give tables unique names (next function)
  167. function makeDTable(title, contents, isOpened) { // renders a dynamic table
  168.     // header
  169.     document.write('<p><table class="table-header" onClick="switchDTable(\''); // >>> table header
  170.     document.write('table'+(++countDTable)); // increase counter & write caller name
  171.     document.write('\');" width="100%" border="0" cellspacing="0" cellpadding="0">');
  172.     document.write('<tr>');
  173.     document.write('<td width="22" height="22" align="left" background="img_glob/_dyntbl_top.gif">'); // >>> top left edge
  174.     if (isOpened) document.write('<img src="img_glob/_dyntbl_topleft2.gif" name="');
  175.     else document.write('<img src="img_glob/_dyntbl_topleft1.gif" name="');
  176.     document.write('table'+countDTable+'gadget'); // write image name
  177.     document.write('" width="22" height="22"></td>'); 
  178.     document.write('<td height="22" align="left" background="img_glob/_dyntbl_top.gif">'); // >>> top (title)
  179.     document.write('<nobr><span class="table-title">'+title+'</span> <span class="table-titlenote">(click here for more information)</span></nobr></td>'); // write title
  180.     document.write('<td width="22" height="22" align="right" background="img_glob/_dyntbl_top.gif"><img src="img_glob/_dyntbl_topright.gif" width="23" height="22"></td></tr></table>'); // >>> top right edge
  181.     if (isOpened) document.write('<div class="table-body" style="display: block" id="table'+countDTable+'body">'+contents+'</div>'); // >>> write table body name (opened) & contents
  182.     else document.write('<div class="table-body" style="display: none" id="table'+countDTable+'body">'+contents+'</div>'); // >>> write table body name (closed) & contents    
  183.     document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>'); // >>> bottom section
  184.     document.write('<td width="22" height="22" align="left" background="img_glob/_dyntbl_bottom.gif"><img src="img_glob/_dyntbl_bottomleft.gif" width="23" height="22"></td>'); // >>> bottom left edge
  185.     document.write('<td height="22" background="img_glob/_dyntbl_bottom.gif"> </td>'); // >>> bottom side
  186.     document.write('<td width="22" height="22" align="right" background="img_glob/_dyntbl_bottom.gif"><img src="img_glob/_dyntbl_bottomright.gif" width="23" height="22"></td>'); // >>> bottom right edge
  187.     document.write('</tr></table></p>');
  188. }
  189. function makePlugDTable(i) { // makes a "plugin" dynamic table (based on the regInfo index)
  190.   var contents='';
  191.     contents+='<table border="0" cellspacing="0" cellpadding="0"><tr>';
  192.     contents+='<td><img src="img_glob/Register '+regInfo[i].name+'.gif" width="130" height="130" align="left">';
  193.     contents+=productText[i]+'</td></tr></table>';
  194.     contents+='<br><br>Click '+returnBuyLink(regInfo[i].code)+'here</a> to order.';
  195.     if (regInfo[i].name=='SimSynth') {
  196.         makeDTable('SimSynth Live',contents, false);
  197.     } else {
  198.         makeDTable(regInfo[i].name,contents, false);
  199.     }
  200.         
  201. }
  202. function makeFLDTable(i) { // makes a "FL info" dynamic table (based on the regInfo index)
  203.     var titleEnd; // modifies the table title
  204.   var contents='<table border="0" cellpadding="5" cellspacing="5">';
  205.     contents+='<tr valign="top">';
  206.     var cellSpan; // how many percent spans each table cell
  207.     if (i==-1) cellSpan='33%';
  208.     if (i==2) cellSpan='50%';
  209.     if (i==1) cellSpan='100%';
  210.  
  211.     if (i==0) {    // if all upgrades are purchased, just write "no upgrades.."
  212.         document.write('<p>No FL-Studio upgrades are available for your release.</p>');
  213.     } else { // write the tables..
  214.         if (i==-1) {
  215.             titleEnd="purchases";
  216.             contents+='<td width="'+cellSpan+'" class="fl-tbl">';
  217.             contents+=productText[2];
  218.             if (i==-1) {
  219.                 contents+='<p>'+returnBuyLink(31000)+'Click here to buy Express Edition ($49).</a></p>';
  220.             }                
  221.             contents+='</td>';
  222.             
  223.         } else {
  224.             titleEnd="upgrades";
  225.         }
  226.         if (i==2 || i==-1) {
  227.             contents+='<td width="'+cellSpan+'" class="fl-tbl">';
  228.             contents+=productText[1];
  229.             if (i==-1) {    
  230.                 contents+='<p>'+returnBuyLink(31010)+'Click here to buy FruityLoops Edition ($99).</a></p>';
  231.             }        
  232.             if (i==2) {
  233.                 contents+='<p>'+returnBuyLink(31050)+'Click here to upgrade to FruityLoops Edition ($59).</a></p>';
  234.             }                
  235.             contents+='</td>';
  236.         }
  237.         if (i>=1 || i==-1) {
  238.             contents+='<td width="'+cellSpan+'" class="fl-tbl">';
  239.             contents+=productText[0];
  240.             if (i==-1) {    
  241.                 contents+='<p>'+returnBuyLink(31020)+'Click here to buy Producer Edition ($149).</a></p>';    
  242.             }            
  243.             if (i==1) {
  244.                 contents+='<p>'+returnBuyLink(31040)+'Click here to upgrade to Producer Edition ($59).</a></p>';
  245.             }    
  246.             if (i==2) {
  247.                 contents+='<p>'+returnBuyLink(31051)+'Click here to upgrade to Producer Edition ($109).</p>';
  248.             }                    
  249.             contents+='</td>';
  250.         }            
  251.         contents+='</tr></table>';
  252.         makeDTable('Available FL-Studio '+titleEnd,contents, true);
  253.     }
  254. }
  255. // --------------------------------------
  256.  
  257. // --------------------------------------
  258. // procedures for writing the links
  259. // --------------------------------------
  260. function returnLink(action, productID) { // returns link for the product/action specified
  261.     var linkContent='';
  262.     linkContent+='<a href="http://flredirect.e-officedirect.com/flredirect.exe?forumname=flstudio';
  263.     linkContent+='&action='+action;
  264.     linkContent+='&username='+escape2(userData[0]);
  265.     // linkContent+='&applicationID='+escape2(params[2])+'; appID not needed
  266.     if (action=='buy') linkContent+='&P_code='+productID; // product code only in buy/upgrade links
  267.     linkContent+='" target="_blank" class="link-common">';
  268.     return linkContent;
  269. }
  270. function returnSupportLink() { // support request link (reg problems)    
  271.     return returnLink('supportrequest',0);
  272. }
  273. function returnRegisterLink() { // code request/register link    
  274.     return returnLink('register',0);
  275. }
  276. function returnBuyLink(productID) { // product buy/upgrade    
  277.     return returnLink('buy',productID);
  278. }
  279. // --------------------------------------